home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2803 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  30 lines

  1. Newsgroups: comp.lang.c
  2. Path: vijay.chinalake.navy.mil!user
  3. From: vijay@nawc690.chinalake.navy.mil (Jim Vijay)
  4. Subject: Passing multidimensional arrays to functions in C
  5. Message-ID: <vijay-2301961215460001@vijay.chinalake.navy.mil>
  6. Sender: usenet@avalon.chinalake.navy.mil (NAWS news admin)
  7. Organization: NAWC
  8. Date: Tue, 23 Jan 1996 20:13:31 GMT
  9.  
  10. The C FAQ (Q's 6.16 thru 6.20) explains how to pass 2D arrays to functions
  11. in C.  None of the methods shown is as simple or general as languages such
  12. as (gasp!) FORTRAN.
  13.  
  14. While realizing that I'm inviting flames, and realizing this topic
  15. may have been discussed to death in the past (but not in the FAQ),
  16. let me ask:
  17.  
  18.    What would break (or even be damaged) in C if the language allowed
  19.    one to pass the width of a 2D array (in general, n-1 dimensions of
  20.    an n dim array) to a function?  It should be easy for a compiler to
  21.    emit code that dynamically depends on these n-1 dimensions. 
  22.    FORTRAN (IV?) at the time of C's birth could do it!
  23.  
  24. Please note that I'm not asking how the C language defines and uses multi
  25. dimensional array parameters to functions.  I would like to know _why_ the
  26. current mechanism was chosen - initially (by K&R?) and later by the ANSI
  27. C committees.
  28.  
  29. Thanks.
  30.